package cn.qdhlm.access;

import com.healthmarketscience.jackcess.Database;

import java.util.List;
import java.util.Map;

public class Application {
    public static void main(String[] args) {
        String dbPath = "/Users/jiangcs/workspace/IdeaProjects/operate-access-db/db/20200810005.mdb";
        Database database = AccessDbHelper.open(dbPath);
        if (null == database) {
            System.err.println("数据库文件打开失败");
            return;
        }

        // 读取所有数据表数据
        Map<String, List<Map<String, Object>>> allTableDataMap = AccessDbHelper.read(database);
        if (null == allTableDataMap) {
            System.err.println("读取数据库全部数据异常");
            return;
        }
        System.out.println("allTableDataMap.size: " + allTableDataMap.size());

        // 读取指定数据表数据
        List<Map<String, Object>> tableDataMapList = AccessDbHelper.read(database, "YAxisTab8");
        if (null == tableDataMapList) {
            System.err.println("读取数据库指定表数据异常");
            return;
        }
        System.out.println("tableDataMapList.size: " + tableDataMapList.size());
    }
}
